/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pb138.accountingRecords;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
/**
 *
 * @author PC
 */
public class MainPaymentTest {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws ParseException {
        
        PaymentManager manager = new PaymentManagerImpl("/db/accounting-records/payments","admin","admin");
        
        
        Payment payment = new Payment();
        payment.setAmount(new BigDecimal(999));
        payment.setBankAcc("123456789/1234");
        payment.setDestinationAcc("578451298/4785");
        
        
        Calendar cal = Calendar.getInstance();
        cal.set(1990,0,11,10,38);
        
        Calendar from = Calendar.getInstance();
        from.set(1989,7,18,10,37);
     
        Calendar to = Calendar.getInstance();
        to.set(2012,7,18,10,38);
        
        payment.setTransferDate(cal.getTime());
        
        payment.setVariableSymbol(8545l);
        payment.setNote(null);
        //payment.setId("d925b471.xml");
        
        //manager.addPayment(payment);
        
        //manager.updatePayment(payment);
        //System.out.println(manager.getPayment("d925b471.xml"));
       
        for(Payment pay:manager.getPaymentsForPeriod(from.getTime(),to.getTime())){
            System.out.println(pay.toString());
        }
        
        System.err.printf(manager.paymentSum(from.getTime(),to.getTime()).toPlainString());
        
        //manager.removePayment("b68c0e47.xml");
    }
}
